package service;

import common.Message;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author 余一
 * @date 2021/11/2  11:32
 * 离线消息线程管理
 */
public class OfflineMessageThreadManager {

    private static ConcurrentHashMap<String, ArrayList<Message>> offlineUserMessages = new ConcurrentHashMap<>();

    public static void addOfflineMessage(String userId,ArrayList<Message> messages){
        offlineUserMessages.put(userId,messages);
    }

    public static void deleteOfflineMessage(String userId){
        offlineUserMessages.remove(userId);
    }

    public static ConcurrentHashMap<String,ArrayList<Message>> getDb(){
        return offlineUserMessages;
    }
}
